<?php include '../templates/choice/common/header.html';?>
<div class="layui-container fly-marginTop fly-user-main">
    <div class="layui-row">
		<!-- 公告-->
		<?php if(isset($config['notice']) AND $config['notice']):?>
		<blockquote class="layui-elem-quote layui-text" style="background-color: #ffffff;">
			<i class="layui-icon layui-icon-speaker"></i><?php echo $config['notice'];?>
		</blockquote>
		<?php endif;?>
        <div class="layui-col-md6">
            <div class="layui-card layui-form-pane">
                <div class="layui-card-header layui-hide-xs">购买商品</div>
				<div class="layui-tab-brief layui-hide-md"><ul class="layui-tab-title"><li class="layui-this">购买商品</li><li class=""><a href="/product/query">查询订单</a></li></ul></div>

                <div class="layui-card-body" id="prodcut_num">
                    <form class="layui-form" action="">
						<div id="product_input">
							<div class="layui-form-item productname">
								<label class="layui-form-label">商品分类</label>
								<div class="layui-input-block">
									<select name="typeid" id="typeid" lay-filter="typeid" lay-verify="required">
										<option value="">请选择</option>
										<?php if(!empty($products_type)):?>
										<?php foreach($products_type AS $type):?>
											<?php if(isset($type['password'])):?>
											<option value="<?php echo $type['id'];?>" data-type="<?php if(strlen($type['password'])>0):?>1<?php else:?>0<?php endif;?>"><?php echo $type['name'];?></option>
											<?php else:?>
											<option value="<?php echo $type['id'];?>" data-type="0"><?php echo $type['name'];?></option>
											<?php endif;?>
										<?php endforeach;?>
										<?php endif;?>
									</select>
								</div>
							</div>
							<div class="layui-form-item productname">
								<label class="layui-form-label">商品列表</label>
								<div class="layui-input-block">
									<select name="pid" id="productlist" lay-filter="productlist" lay-verify="required">
	  
									</select>
								</div>
							</div>
							
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">商品单价</label>
									<div class="layui-input-block">
										<input type="text" name="price" id="price" readonly disabled class="layui-input" style="color: red;">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">订单金额</label>
									<div class="layui-input-block">
										<input type="text" name="money" id="money" readonly disabled class="layui-input" value ="" style="color: red;">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">商品库存</label>
									<div class="layui-input-block">
										<input type="text" name="qty" id="qty" readonly disabled class="layui-input">
									</div>
								</div>
							</div>
							<div class="layui-col-md12 layui-col-xs6">
								<div class="layui-form-item">
									<label class="layui-form-label">购买数量</label>
									<div class="layui-input-block">
										<input type="number" name="number" maxlength=10 id="number" value="1" class="layui-input" lay-verify="required|numberCheck">
									</div>
								</div>
							</div>
							<?php if($login):?>
							<div class="layui-form-item">
								<label class="layui-form-label">邮箱账户</label>
								<div class="layui-input-block">
									<input type="text" name="email" id="email" value="<?php echo $uinfo['email'];?>" readonly class="layui-input">
								</div>
							</div>
							<?php else:?>
								<?php if(isset($config['orderinputtype']) AND $config['orderinputtype'] == '2'):?>
								<div class="layui-form-item">
									<label class="layui-form-label">QQ</label>
									<div class="layui-input-block">
										<input type="number" name="qq" id="qq" class="layui-input" required lay-verify="required|number">
									</div>
								</div>
								<?php else:?>
								<div class="layui-form-item">
									<label class="layui-form-label">邮箱账户</label>
									<div class="layui-input-block">
										<input type="text" name="email" id="email" class="layui-input" required lay-verify="required|email">
									</div>
								</div>
								<?php endif;?>
							<?php endif;?>
							
							<?php if(isset($config['querycontactswitch']) AND $config['querycontactswitch']>0):?>
							<div class="layui-form-item">
								<label class="layui-form-label">查询密码</label>
								<div class="layui-input-block">
									<input type="text" name="chapwd" id="chapwd" class="layui-input" required lay-verify="required|chapwd" placeholder="将作为自助查询订单重要依据">
								</div>
							</div>
							<?php endif;?>
						</div>	
                        <div class="layui-form-item">
                            <div class="layui-input-block">
								<input type="hidden" name="limitorderqty" id="limitorderqty" value="<?php echo $config['limitorderqty'];?>">
								<input type="hidden" name="stockcontrol" id="stockcontrol" value="0">
                                <button class="layui-btn" id="buy" disabled="disabled" lay-submit lay-filter="buy">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md6 <?php if(isset($config['mprodcutdescriptionswitch'])):?><?php if($config['mprodcutdescriptionswitch']=="0"):?>layui-hide-xs<?php endif;?><?php else:?>layui-hide-xs<?php endif;?>">
            <div class="layui-card">
                <div class="layui-card-header">商品详情</div>
                <div class="layui-card-body" id="prodcut_description">
				<?php if(isset($config['ad'])):?><?php echo $config['ad'];?><?php endif;?>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="layerad" style="display: none;"><?php echo $config['layerad'];?></div>
<!--引入公共底文件-->
<?php include '../templates/choice/common/footer.html';?>
<!--首页广告-->
<script>
layui.use('product');
var PIFA = "";
</script>